﻿<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="{lang.LANG_SMALL_NAME}" xml:lang="{lang.LANG_SMALL_NAME}">
<head>
<title>{lang.KLEEJA_CP} - {config.sitename}</title>
<!-- top-head -->
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="apple-mobile-web-app-capable" content="yes" />
<meta http-equiv="Content-Language" content="{lang.LANG_SMALL_NAME}" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="shortcut icon" href="{DEFAULT_PATH_ADMIN}images/favicon.ico" />
<link rel="icon" type="image/gif" href="{DEFAULT_PATH_ADMIN}images/favicon.gif" />
<link rel="stylesheet" href="{STYLE_PATH_ADMIN}/jquery.mobile-1.1.0.min.css" />
<link rel="stylesheet" type="text/css" media="screen" href="{STYLE_PATH_ADMIN}byname.css" />
<IF NAME="{lang.DIR}==rtl"><link rel="stylesheet" type="text/css" media="screen" href="{STYLE_PATH_ADMIN}rtl.css" /></IF>	

<script type="text/javascript">
<!--//
var STYLE_PATH_ADMIN = '{DEFAULT_PATH_ADMIN}';
var go_to = '{go_to}';
//-->
</script>
<script type="text/javascript" src="{DEFAULT_PATH_ADMIN}js/jquery.min.js"></script>
 <script src="{STYLE_PATH_ADMIN}/jquery.mobile-1.1.0.min.js"></script>
<script type="text/javascript">
<!--//
jQuery(document).ready(function($){

	setTimeout( function(){ window.scrollTo(0, 1); }, 100 );

	//for # in address bar
	hash = window.location.hash.replace('#!', '');
	where_are_we = hash.match(/cp\=([0-9a-z_]+)/);

	//get_kleeja_link('./', '#content', {});
	
	
});

function get_kleeja_link(URL, ID, p)
{
	if(!p){
		p = {};
	}

	if(!ID){
		ID = '#content';
	}

	$("#sign_ajax_error").css('display', 'none');

	if(p['confirm']){
		if(!confirm_from()){
			return;
		}
	}

	//$(ID).css('display', 'none');
	$(ID).addClass('show_less');
	
	if(URL.indexOf('?') == -1){
		URL += '?';
	}
	
	window.location.hash = '!' + URL.replace('&amp;', '&').split('?', 2)[1];
	if(window.location.hash.indexOf('formkey') != -1){
		window.location.hash = window.location.hash.replace(/&formkey=[a-z0-9]+/, '');
	}

	$("#sign_ajax").show();

	$.ajax({
		url: URL.replace('&amp;', '&') + '&_ajax_=1',
		cache: false,
		dataType: 'json',
		success: function(R){
			
			$("#sign_ajax").css('display', 'none');

			//not login 
			if(R.code == 999){
				location.href = './';
			} else if(R.code == 888) {
				alert(R.content);
				get_kleeja_link(URL, ID);
				return;
			} else {
				$(ID).html(R.content);

				if(p['current_id']){
					$('.' + p['current_class']).removeClass(p['current_class']);
					$('#' + p['current_id']).addClass(p['current_class']);
				}

				$(ID).removeClass('show_less');
				$(ID).fadeIn(100);

				if($('body').scrollTop() > 0 && $('body').scrollTop() > 200){
					$('body').animate({scrollTop:0}, 'slow');
				} else if($('html').scrollTop() > 0 && $('html').scrollTop() > 230){
					$('html').animate({scrollTop:0}, 'slow');
				}

				$('#gomenu').html('').fadeOut("slow")
				if(R.menu) {
					mmmenu = R.menu.replace('<a ', '<a data-theme="c" data-icon="" ');
					$('#gomenu').html(mmmenu).fadeIn("slow");
				}
			}
		},
		error : function(R){
			//$(ID).html('----');
			$("#sign_ajax").css('display', 'none');
			$("#sign_ajax_error").show();
		}
	});
}

function submit_kleeja_data(FORM_ID, ID, CONFIRM)
{
	if(!ID){
		ID = '#content';
	}

	if(CONFIRM){
		if(!confirm_from()){
			return;
		}
	}
	
	URL = $(FORM_ID).attr('action');
	if(URL.indexOf('?') == -1){
		URL += '?';
	}
	window.location.hash = '!' + URL.replace('&amp;', '&').split('?', 2)[1];
	if(window.location.hash.indexOf('formkey') != -1){
		window.location.hash = window.location.hash.replace(/&formkey=[a-z0-9]+/, '');
	}

	$("#sign_ajax_error").css('display', 'none');
	//$(ID).css('display', 'none');
	$(ID).addClass('show_less');
	$("#sign_ajax").show();
	
	$.ajax({
		type: 'POST',
		url: URL.replace('&amp;', '&') + '&_ajax_=1',
		data: $(FORM_ID).serialize(),
		cache: false,
		dataType: 'json',
		success: function(R){
			
			$("#sign_ajax").css('display', 'none');
			
			//not login 
			if(R.code == 999){
				location.href = './';
			}else if(R.code == 888){
				if(R.content != ''){
					alert(R.content);
				}
				get_kleeja_link($(FORM_ID).attr('action'), ID);
				return;
			}else{
				$(ID).html(R.content);
				$(ID).removeClass('show_less');
				$(ID).fadeIn(100);
				if($('body').scrollTop() > 0 && $('body').scrollTop() > 200){
					$('body').animate({scrollTop:0}, 'slow');
				}else if($('html').scrollTop() > 0 && $('html').scrollTop() > 230){
					$('html').animate({scrollTop:0}, 'slow');
				}
				
				
				$('#gomenu').html('').fadeOut("slow")
				if(R.menu){
						mmmenu = R.menu.replace('<li ', '<li data-theme="c" data-icon="" ');
						$('#gomenu').html(mmmenu).fadeIn("slow");
				}

			}
		},
		error : function(R){
			//$(ID).html('----');
			$("#sign_ajax").css('display', 'none');
			$("#sign_ajax_error").show();
		}
	});
}

function change_color(obj, id, c, c2) {
    c = (c == null) ? 'ored' : c;
    c2 = (c == null) ? 'osilver' : c2;
    var ii = document.getElementById(id);
    if (obj.checked) {
        ii.setAttribute("class", c);
        ii.setAttribute("className", c)
    } else {
        ii.setAttribute("class", c2);
        ii.setAttribute("className", c2)
    }
}
function checkAll(form, id, _do_c_, c, c2) {
    for (var i = 0; i < form.elements.length; i++) {
        if (form.elements[i].getAttribute("rel") != id) continue;
        if (form.elements[i].checked) {
            uncheckAll(form, id, _do_c_, c, c2);
            break
        }
        form.elements[i].checked = true;
        change_color(form.elements[i], _do_c_ + '[' + form.elements[i].value + ']', c, c2)
    }
}
function uncheckAll(form, id, _do_c_, c, c2) {
    for (var i = 0; i < form.elements.length; i++) {
        if (form.elements[i].getAttribute("rel") != id) continue;
        form.elements[i].checked = false;
        change_color(form.elements[i], _do_c_ + '[' + form.elements[i].value + ']', c, c2)
    }
}
function change_color_exts(id) {
    eval('var ii = document.getElementById("su[' + id + ']");');
    eval('var g_obj = document.getElementById("gal_' + id + '");');
    eval('var u_obj = document.getElementById("ual_' + id + '");');
    if (g_obj.checked && u_obj.checked) {
        ii.setAttribute("class", 'o_all');
        ii.setAttribute("className", 'o_all')
    } else if (g_obj.checked) {
        ii.setAttribute("class", 'o_g');
        ii.setAttribute("className", 'o_g')
    } else if (u_obj.checked) {
        ii.setAttribute("class", 'o_u');
        ii.setAttribute("className", 'o_u')
    } else {
        ii.setAttribute("class", '');
        ii.setAttribute("className", '')
    }
}
function checkAll_exts(form, id, _do_c_) {
    for (var i = 0; i < form.elements.length; i++) {
        if (form.elements[i].getAttribute("rel") != id) continue;
        if (form.elements[i].checked) {
            uncheckAll_exts(form, id, _do_c_);
            break
        }
        form.elements[i].checked = true;
        change_color_exts(form.elements[i].value)
    }
}
function uncheckAll_exts(form, id, _do_c_) {
    for (var i = 0; i < form.elements.length; i++) {
        if (form.elements[i].getAttribute("rel") != id) continue;
        form.elements[i].checked = false;
        change_color_exts(form.elements[i].value)
    }
}
//-->
</script>
</head>
<body>

<!-- ajax loading sign -->
<div id="sign_ajax"><img src="{DEFAULT_PATH_ADMIN}images/ajax-loader-small.gif" /> {lang.LOADING} ...</div>
<div id="sign_ajax_error" onclick="javascript:get_kleeja_link('./');"><img src="{DEFAULT_PATH_ADMIN}images/error.png" /> {lang.ERROR_AJAX}</div>


	<!-- home -- first page -->
        <div data-role="page" id="home">
            <div data-theme="d" data-role="header">
                <h3>
                    Kleeja ACP
                </h3>
                <div data-role="navbar" data-iconpos="top">
                    <ul>
					
                        <li>
                            <a href="{config.siteurl}" data-theme="" data-icon="home">
                                {lang.RETURN_HOME}
                            </a>
                        </li>
                        <li>
                            <a href="./?cp=b_lgoutcp&amp;{GET_FORM_KEY_GLOBAL}" onclick="javascript:return confirm_from();" data-theme="" data-icon="delete">
                                {lang.R_LGOUTCP}
                            </a>
                        </li>
                        <li>
                            <a href="http://moffed.com" target="_blank" data-theme="" data-icon="info">
                                {lang.SUPPORT_MOFFED}
                            </a>
                        </li>
                    </ul>
                </div>
			</div>
			<div data-role="content">
                <ul data-role="listview" data-divider-theme="b" data-inset="true">
                    <li data-role="list-divider" role="heading">
                        {lang.MENU}
                    </li>
                    <li data-theme="d">
                        <a href="#page1" onclick="javascript:get_kleeja_link('./', '#content', {}); return false;" data-transition="slide">
                            {lang.R_CPINDEX}
                        </a>
                    </li> 
					<LOOP NAME="adm_extensions_menu">
					<li data-theme="d">
                        <a href="#page1" onclick="javascript:get_kleeja_link('{{link}}', '#content', {}); return false;" data-transition="slide">
                            {{title}}
                        </a>
                    </li>
					</LOOP>
                </ul>
            </div>
        </div>
		
	<!---- page 1 - content -->

	        <div data-role="page" id="page1">
            <div data-theme="a" data-role="header">
                <h3>
                    Kleeja ACP
                </h3>
                <div data-role="navbar" data-iconpos="left">
                    <ul>
                        <li>
                            <a href="#home" data-theme="b" data-icon="arrow-l">
                                {lang.GO_BACK_BROWSER}
                            </a>
                        </li>
                    </ul>
                </div>
			    <div data-role="fieldcontain">
                    <select name="selectmenu1" id="gomenu" onchange="location.href='#page1';javascript:get_kleeja_link(this.options[this.selectedIndex].value); return false;">
                        <option value="option1">
                           {lang.MENU}
                        </option>
                    </select>
                </div>
            </div>
            <div data-role="content" id="content">

